<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<%-- <script src="${pageContext.request.contextPath}/core/js/jquery.js"> </script> --%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>通知设置</title>
<script src="http://wx.wiz-tech.com.cn/js/jquery-1.7.2.js" type="text/javascript"> </script>
</head>
<body>
	<div>
		<div>
			以下操作，通过微信向你发送通知
		</div>
		<div>
			消息通知<input type="checkbox" id="advices">
		</div>
		<div>
			充值通知<input type="checkbox" id="topUp">
		</div>
		<div>
			补卡通知<input type="checkbox" id="cardReissue">
		</div>
		<div>
			销户通知<input type="checkbox" id="closingAnAccount">
		</div>
	</div>
</body>
<script type="text/javascript">
	$(":checkbox").bind("change", function(){
		  var messageName =  $(this).attr("id");
		  var messageValue= 0;
		  var doc = $(this);
		  if($(this).attr("checked")){
			  messageValue = 1;
		  }
		  
		  $.ajax({
				type : "post",
				url : "updateMessage",
				data : {messageName:messageName,messageValue:messageValue},
				dataType : "json",
				async : true,
				success : function(data) {
					if(data.code*1 == 200){
						alert("修改成功");
					}else{
						alert(messageValue == 1?false:true);
						$(doc).attr("checked",messageValue == 1?false:true);
					}
				}
			});
	});
// 	var notifcation = {
// 			advices : function(doc){
// 				 alert( $(doc).attr("id"));
// 			}
// 	}
</script>
</html>